import requests
from business.base_token import BaseToken
from config.parseconfig import config_json_data

class OA(BaseToken):
    def __init__(self,secret=config_json_data['checkin_secret']):
        super().__init__(secret)

    def get_checkin_data(self,opencheckindatatype,starttime,endtime,useridlist):
        url = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token="+self.token
        data = {
            "opencheckindatatype": opencheckindatatype,
            "starttime": starttime,
            "endtime": endtime,
            "useridlist": useridlist
        }

        print("=================",data,"========================")
        # json 表示 发送的数据为json 格式
        # data 表示 表单格式
        return requests.post(url,json=data)


if __name__ == '__main__':
    oa = OA()
    data = oa.get_checkin_data(opencheckindatatype=3, starttime=1492617600, endtime=1492790400, useridlist=['ZhaoZengYang'])
    print(data.json())